package com.dianping.cat.home.dependency.format.transform;

import com.dianping.cat.home.dependency.format.entity.Domain;
import com.dianping.cat.home.dependency.format.entity.ProductLine;
import com.dianping.cat.home.dependency.format.entity.TopoGraphFormatConfig;
import org.xml.sax.Attributes;




public class DefaultSaxMaker
  extends Object
  implements IMaker<Attributes>
{
  public Domain buildDomain(Attributes attributes) {
/* 16 */     String id = attributes.getValue("id");
/* 17 */     String colInside = attributes.getValue("colInside");
/* 18 */     Domain domain = new Domain();

/* 20 */     if (id != null) {
/* 21 */       domain.setId(id);
    }

/* 24 */     if (colInside != null) {
/* 25 */       domain.setColInside((Integer)convert(Integer.class, colInside, null));
    }

/* 28 */     return domain;
  }


  public ProductLine buildProductLine(Attributes attributes) {
/* 33 */     String id = attributes.getValue("id");
/* 34 */     String colInside = attributes.getValue("colInside");
/* 35 */     ProductLine productLine = new ProductLine();

/* 37 */     if (id != null) {
/* 38 */       productLine.setId(id);
    }

/* 41 */     if (colInside != null) {
/* 42 */       productLine.setColInside((Integer)convert(Integer.class, colInside, null));
    }

/* 45 */     return productLine;
  }



/* 50 */   public TopoGraphFormatConfig buildTopoGraphFormatConfig(Attributes attributes) { return new TopoGraphFormatConfig(); }





  protected <T> T convert(Class<T> type, String value, T defaultValue) {
/* 57 */     if (value == null || value.length() == 0) {
/* 58 */       return defaultValue;
    }

/* 61 */     if (type == Boolean.class || type == boolean.class)
/* 62 */       return (T)Boolean.valueOf(value); 
/* 63 */     if (type == Integer.class || type == int.class)
/* 64 */       return (T)Integer.valueOf(value); 
/* 65 */     if (type == Long.class || type == long.class)
/* 66 */       return (T)Long.valueOf(value); 
/* 67 */     if (type == Short.class || type == short.class)
/* 68 */       return (T)Short.valueOf(value); 
/* 69 */     if (type == Float.class || type == float.class)
/* 70 */       return (T)Float.valueOf(value); 
/* 71 */     if (type == Double.class || type == double.class)
/* 72 */       return (T)Double.valueOf(value); 
/* 73 */     if (type == Byte.class || type == byte.class)
/* 74 */       return (T)Byte.valueOf(value); 
/* 75 */     if (type == Character.class || type == char.class) {
/* 76 */       return (T)Character.valueOf(value.charAt(0));
    }
/* 78 */     return (T)value;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/dependency/format/transform/DefaultSaxMaker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */